﻿<cfscript>
/** 
* ORM MatrixGroupUser
* 
* @hint "Hibernate persistenter t_groupuser. 用户授权信息表" 
* 
*/ 

component 
	displayname="public.service.orm.senate.MatrixGroupUser" 
	output=false 
	persistent=true 
	selectBeforeUpdate=true dynamicInsert=true dynamicUpdate=true 
	cacheuse="Transactional" 
	entityname="MatrixGroupUser" 
	table="t_groupuser"
	{
		
	property type="string" name="UserGroupID" column="ugid" fieldtype="id" generator="assigned" hint="用户授权ID";
		
	property type="string" name="Created" column="date_create" hint="上次登录时间";
	property type="string" name="LastUpdate" column="date_lastupdate" hint="上次登录时间";
		
	property name="MatrixUser" fieldtype="many-to-one" fkcolumn="user_id" cfc="MatrixUser"  hint="帐号";
	property name="MatrixGroup" fieldtype="many-to-one" fkcolumn="group_id" cfc="MatrixGroup"  hint="用户组";
	
	/**
	* @hint "自定义主键规则"
	* 
	* @User "帐号"
	* @Group "用户组"
	*/	
	public string function getID( required User, required Group ) output=false {
		
		var nextID = arguments.User.getUID() & ":" & arguments.Group.getGID();

		/* 
			主键生成规则 
			
			用户代码 + : + 用户组

			Unique: UID, :, GID
		*/
		return nextID;
	}
		
}

</cfscript>
	